package jdbc;

import java.sql.Connection;
import java.util.Scanner;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class ExcluirEditoras {

	public static void main(String[] args){
		Scanner entrada = new Scanner(System.in);
				
		
		try{
			System.out.println("abrindo conExao.....");
			Connection conexao = ConnectionFactory.createConnection();
			System.out.println("digite o codigo da editora");
			int id = Integer.parseInt(entrada.nextLine());
			
			String sql ="DELETE FROM Editora WHERE id = ?";
			
			PreparedStatement comando = conexao.prepareStatement(sql);
			comando.setInt(1, id);
			
			System.out.println("Executando comando");
			comando.execute();
			
			System.out.println("Fechando comando");
			comando.close();
			
		} catch(Exception e){
			e.printStackTrace();
		}
	}

	private static Object nextLine() {
		// TODO Auto-generated method stub
		return null;
	}
}
